package ua.yandex.skipass;

import java.util.Calendar;

public class WeekdayLimitedPass extends SkiPass implements PassLimitedClimbs {
    private int numberOfClimbs;
    private Calendar expirationDate;
    private final DateChecker dateChecker = WeekdayDayType.DEFAULT_DATE_CHECKER;

    WeekdayLimitedPass(ClimbType climbType, Calendar defaultExpirationDate) {
        super(PassType.WEEKDAY);
        expirationDate = defaultExpirationDate;
        numberOfClimbs = climbType.climbs();
    }

    @Override
    public Calendar getExpirationDate() {
        return expirationDate;
    }

    @Override
    public boolean validAt(Calendar someTime) {
        return dateChecker.validAt(someTime);
    }

    @Override
    public int getNumberOfClimbs() {
        return numberOfClimbs;
    }

    @Override
    public void decreaseNumberOfClimbs() {
        --numberOfClimbs;
    }
}
